package com.qf.fmmall.controller;

import com.qf.fmmall.service.CategoryService;
import com.qf.fmmall.service.IndexImgService;
import com.qf.fmmall.service.ProductService;
import com.qf.fmmall.vo.ResultVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/index")
@CrossOrigin
public class IndexController {

    @Autowired
    private IndexImgService indexImgService;

    @GetMapping("/indeximg")
    @ResponseBody
    @ApiOperation("首页轮播图接口")
    public ResultVo listIndexImgs(){
        return indexImgService.listIndexImgs();
    }

    @Autowired
    private CategoryService categoryService;

    @Autowired
    private ProductService productService;


    @GetMapping("/category-list")
    @ResponseBody
    @ApiOperation("商品分类查询接口")
    public ResultVo listCatetory(){
        return categoryService.listCategories();
    }

    @GetMapping("/list-recommends")
    @ResponseBody
    @ApiOperation("查询推荐商品接口")
    public ResultVo listRecommends() {
        return productService.listRecommends();
    }
    @GetMapping("/category-recommends")
    @ResponseBody
    @ApiOperation("查询分类推荐商品接口")
    public ResultVo categoryRecommends() {
        return productService.categoryRecommends();
    }
}
